package com.demo.transaction.config;

import com.zaxxer.hikari.HikariDataSource;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Primary;


public class DataSourceConfig {

    private HikariDataSource primary;
    private HikariDataSource secondary;

    @Bean(name = "primaryDataSource")
    @Qualifier("primaryDataSource")
    public HikariDataSource primaryDataSource() {
        return primary;
    }

    @Bean(name = "secondaryDataSource")
    @Qualifier("secondaryDataSource")
    @Primary
    public HikariDataSource secondaryDataSource() {
        return secondary;
    }

}
